﻿using TheAPI.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json;
using RestSharp;

namespace TheAPI
{
    public class ChampionModule : Module
    {
        private const string VERSION = "v1.1";
        private const string MODULE = "champion";

        public ChampionModule(RiotGamesAPI api)
            : base(api)
        {
        }

        public ChampionList RetrieveAllChampions()
        {
            return RetrieveAllChampions(false);
        }

        public ChampionList RetrieveAllChampions(bool freeToPlay)
        {
            var request = new RestRequest("api/lol/{region}/{version}/{module}/", Method.GET);
            request.AddUrlSegment("region", API.RegionString);
            request.AddUrlSegment("version", VERSION);
            request.AddUrlSegment("module", MODULE);

            request.AddParameter("api_key", API.APIKey);
            request.AddParameter("freeToPlay", freeToPlay);

            return REST<ChampionList>(request);
        }
    }
}
